package com.alm.handle.service.impl;

import com.alm.handle.core.domain.entity.SysDevParam;
import com.alm.handle.core.domain.entity.SysDevParamType;
import com.alm.handle.mapper.SysDevParamMapper;
import com.alm.handle.mapper.SysDevParamTypeMapper;
import com.alm.handle.service.ISysDevParamService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class SysDevParamServiceImpl implements ISysDevParamService {

    @Autowired
    private SysDevParamMapper sysDevParamMapper;

    @Autowired
    private SysDevParamTypeMapper sysDevParamTypeMapper;

    @Override
    public Map<String, List<SysDevParam>> selectDevParamTypeList(Integer paramType) {
        return sysDevParamMapper.selectDevParamTypeList(paramType).stream()
                .collect(Collectors.groupingBy(
                        param -> param.getSysDevParamType().getParamTypeName()
                ));
    }
}
